import { isEmpty } from 'lodash-es';

interface useUserReturnInterface {
  getUser: () => void;
}

export const useUser = (): useUserReturnInterface => {
  const getUser = async () => {
    const user = useUserStore().user;
    if (isEmpty(user)) {
      const res = await userApi();
      if (res.ok) {
        useUserStore().user = res.data;
      }
    }
  };
  return {
    getUser,
  };
};
